package test.构造函数

fun main(args: Array<String>) {
    val person1 = Person("张三",20);
    println(person1.name)
}

class Person(name: String, age: Int) {
    var name: String = ""
    var age: Int = 0

    //构造函数中写的代码可以放到init中执行
    init {
        this.name = name
        this.age = age
    }
}